<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" %>
<%@ page import="org.apache.shiro.authc.AuthenticationException" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  ~   Copyright 1999-2016 Asiainfo Technologies(China),Inc.
  ~
  ~   Licensed under the Apache License, Version 2.0 (the "License");
  ~   you may not use this file except in compliance with the License.
  ~   You may obtain a copy of the License at
  ~
  ~        http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~   Unless required by applicable law or agreed to in writing, software
  ~   distributed under the License is distributed on an "AS IS" BASIS,
  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~   See the License for the specific language governing permissions and
  ~   limitations under the License.
  ~
  --%>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
    <title>登录</title>
</head>

<body>

    <h1 style="margin: 40px auto;color: #007aff">Redis集群管控平台</h1>
    <form id="loginForm" action="${ctx}/login" class="form-horizontal" method="post">
        <%
            AuthenticationException exception = (AuthenticationException)request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
            if (exception != null){
        %>
        <div class="form-group">
            <div class="col-md-9 pull-right">
                <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                        <%=exception.getLocalizedMessage()%>
                </div>
            </div>
        </div>
        <%
            }
        %>
        <div class="form-group">
            <label class="col-md-3 control-label" style="padding-top:12px" for="username">登录名：</label>
            <div class="col-md-9">
                <input class="form-control required" id="username" name="username" placeholder="请输入登录名" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-md-3 control-label" style="padding-top:12px" for="username">密码：</label>
            <div class="col-md-9">
                </span><input class="form-control required" id="password" name="password" placeholder="请输入密码" type="password">
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-9 pull-right">
                <input class="btn btn-lg btn-primary btn-block" type="submit" value="登录">
            </div>
        </div>
    </form>


<script>
    $(document).ready(function () {
        $("#loginForm").validate();
    });
</script>
</body>
</html>
